package com.tridion.utilities.verifier.analyzer;

import java.io.File;
import java.util.List;

import com.tridion.utilities.verifier.model.ContentDeliveryInstallation;
import com.tridion.utilities.verifier.model.JarFile;
import com.tridion.utilities.verifier.utils.JarUtil;

/**
 * Analyzer that checks all jars in the lib folder and adds them to the {@link ContentDeliveryInstallation}.
 * 
 * @author Daniel Neagu
 */
public class JarsAnalyzer implements Analyzer {

    /**
     * Adds information about the jar files present in this installation.
     */
    @Override
    public void analyze(final ContentDeliveryInstallation cdi) {
        // get the lib folder
        final File libFolder = cdi.getLibFolder();
        
        // list all jar files inside
        final List<JarFile> jars = JarUtil.listJars(libFolder);
        
        // set on the installation object
        cdi.setJars(jars);
    }
}
